package com.caiyigo.struts.action;

import org.apache.log4j.Logger;

import com.caiyigo.struts.model.Employee;
import com.caiyigo.struts.service.IEmployeeService;
import com.caiyigo.struts.serviceImpl.EmployeeServiceImpl;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 
 * @author xdwang 
 * 
 * @date 2012-6-6 下午8:38:14
 * 
 * @email xdwangiflytek@gmail.com
 * 
 * @blog xdwangiflytek.iteye.com
 *
 */
public class EmployeeDeleteAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	private static Logger logger = Logger.getLogger(EmployeeDeleteAction.class
			.getName());
	private static IEmployeeService empService = new EmployeeServiceImpl();

	private Employee employee;

	/**
	 * Delete the Employee object based on the value of the employeeId field
	 * from the data repository.
	 * 
	 * @return success
	 */
	public String delete() {
		logger.debug("in method delete");

		if (employee != null && employee.getEmployeeId() != null) {
			logger.debug("Employee ID is " + employee.getEmployeeId());

		}
		empService.deleteEmployee(employee.getEmployeeId());

		return SUCCESS;
	}

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

}
